import { HTTP } from '../utils/http-p'

class BookModel extends HTTP {
    getHotList () {
        return this.request({
            url: 'book/hot_list'
        })
    }

    getDetail (id) {
        return this.request({
            url: `/book/${id}/detail`
        })
    }

    getComments (id) {
        return this.request({
            url: `/book/${id}/short_comment`
        })
    }

    getLikeStatus (id) {
        return this.request({
            url: `/book/${id}/favor`
        })
    }

    getMyBookCount () {
        return this.request({
            url: '/book/favor/count'
        })
    }

    postComment (id, comment) {
        return this.request({
            url: 'book/add/short_comment',
            method: 'POST',
            data: {
                book_id: id,
                content: comment
            }
        })
    }

    getSearch (start, q) {
        return this.request({
            url: 'book/search',
            data: {
                start,
                q
            }
        })
    }
}

export { BookModel }
